//
//  ChatHistroyModule.h
//  Gabber
//
//  Created by 惠国 陆 on 11-9-28.
//  Copyright 2011年 恒生聚源. All rights reserved.
//

#import <Foundation/Foundation.h>
#include <AudioToolbox/AudioToolbox.h>

@protocol MessageStorage;

@interface MessageModule : XMPPModule
{
    id <MessageStorage> _messageStorage;
    
    SystemSoundID	_sendMessageSound;
	SystemSoundID	_receiveMessageSound;
}

- (id)initWithMessageStorage:(id <MessageStorage>)storage;
- (id)initWithMessageStorage:(id <MessageStorage>)storage dispatchQueue:(dispatch_queue_t)queue;


@property (readonly) id <MessageStorage> messageStorage;
@property (readonly)	SystemSoundID	sendMessageSound;
@property (readonly)	SystemSoundID	receiveMessageSound;
@end


@protocol MessageStorage <NSObject>

- (BOOL)configureWithParent:(MessageModule *)aParent queue:(dispatch_queue_t)queue;


- (void)handleMessage:(XMPPMessage *)message xmppStream:(XMPPStream *)stream;

- (void)clearAllMessagesForXMPPStream:(XMPPStream *)stream;
- (void)clearMessagesForJID:(XMPPJID *)jid xmppStream:(XMPPStream *)stream;

- (void)clearAllReadedMessagesForXMPPStream:(XMPPStream *)stream;
- (void)clearReadedMessagesForJID:(XMPPJID *)jid xmppStream:(XMPPStream *)stream;

@end


@protocol MessageDelegate
@optional



@end
